<!DOCTYPE html>
{extend name="common/application" /}
{block name="title"}<title>个人中心-实名认证-个人</title>{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="_CSS_/help.css" />
<link rel="stylesheet" type="text/css" href="_CSS_/personal.css"/>
<link rel="stylesheet" type="text/css" href="_CSS_/cefi.css"/>
<style type="text/css">
	.form-group{overflow: hidden;}
	.files{background: url(/static/web/images/upload01.png) no-repeat;}
	.files01{background: url(/static/web/images/upload03.png) no-repeat;}
	.files02{background: url(/static/web/images//upload02.png) no-repeat;}
	#form3 img{width: auto;margin: 0;}
	.file-panel,.del_cancel{width: 200px;height: 200px;}
	#form4 label,#form5 label{width: 120px;}
	#form4 span,#form5 span{width: auto;}
	.editBtn1 {
		width: 160px;
		height: 48px;
		line-height: 48px;
		text-align: center;
		display: block;
		background: #3377C1;
		color: #FFFFFF;
		font-size: 16px;
		margin-left: 115px;
	}
	.editBtn1:hover{color: #ffffff;}
	.form-group img{width:220px;height:220px;margin-right:10px;vertical-align:top;}
	.editBtn{margin-left:10px;display:inline-block;}
</style>
{/block}
<!-- 主体内容 -->
{block name="content"}

			<!-- 主体内容 -->
			<div class="main">
				<div class="mainBody normalBox clearfix">
					<!--左菜单-->
					<ul class="menuList fl">
						<li class="showChild">
							<a class="menuItem dropBg" href="personal.html"><span class="icons icon-account"></span>账户管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="personal.html">个人资料</a>
								<a class="menuchildItem activeMenu" href="certification.html">实名认证</a>
								<a class="menuchildItem" href="account.html">账户安全</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="order.html"><span class="icons icon-order"></span>我的订单</a>
							<div class="childMenu">
								<a class="menuchildItem" href="order.html">我的订单</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="collect_news.html"><span class="icons icon-collection"></span>我的收藏</a>
							<div class="childMenu">
								<a class="menuchildItem" href="collect_news.html">资讯收藏</a>
								<a class="menuchildItem" href="collect_course.html">课程收藏</a>
								<a class="menuchildItem" href="collect_products.html">商品收藏</a>
								<a class="menuchildItem" href="collect_stores.html">店铺收藏</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="address.html"><span class="icons icon-address"></span>地址管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="address.html">地址管理</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="judge.html"><span class="icons icon-evaluate"></span>评价管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="judge.html">评价管理</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="complain.html"><span class="icons icon-price"></span>申述退款</a>
							<div class="childMenu">
								<a class="menuchildItem" href="complain.html">申述</a>
								<a class="menuchildItem" href="refund_money.html">退款</a>
							</div>
						</li>
						<li class="bb0">
							<a class="menuItem dropBg" href="message.html"><span class="icons icon-news"></span>消息中心</a>
							<div class="childMenu">
								<a class="menuchildItem" href="message.html">消息中心</a>
							</div>
						</li>
					</ul>
					<!--右内容-->
					<div class="menuContent fr">
						<div class="menuConHeader">
							<!--面包屑导航-->
							<div class="breadcrumb">
								<p>当前位置：
									<a href="personal.html">账户管理</a> &gt;
									<a href="certification.html">实名认证</a> &gt;
									<a class="curPage" href="javascript:;">企业认证</a>
								</p>
							</div>
						</div>
						<div class="menuConBody">

							<!--第一步-->
							<form id="form1" action="" method="post" class='forms firstStep hide'>
								<div class='form-group'>
									<label>单位类型：</label>
									<div class="radioBox fl">
										<input class='form-control organization ml0' type='radio' name="organization" checked="checked" value="normal"/>普通企业
										<input class='form-control organization' type='radio' name="organization"  value="career"/>事业单位
									</div>
								</div>
								<div class='form-group papers'>
									<label>证件类型：</label>
									<div class="radioBox fl">
										<input class='form-control paper ml0' type='radio' name="paper" checked="checked" value="1"/>普通营业执照(有组织机构代码证和税务登记证)
										<input class='form-control paper' type='radio' name="paper" value="2"/>多证合一营业执照(无组织机构代码证和税务登记证)
									</div>
								</div>
								<div class='form-group enterprise'>
									<label>企业名称：</label>
									<input class='form-control enterprises' name='enterprises' type='text' placeholder="请输入企业名称"/>
								</div>
								<div class='form-group enterpriseNo'>
									<label>企业注册号：</label>
									<input class='form-control enterpriseNumber' name='enterpriseNumber' type='text' placeholder="请输入企业注册号"/>
								</div>
								<div class='form-group institution hide'>
									<label>事业单位名称：</label>
									<input class='form-control institutions' name='institutions' type='text' placeholder="请输入事业单位名称"/>
								</div>
								<div class='form-group card hide'>
									<label>事证号：</label>
									<input class='form-control cards' name='cards' type='text' placeholder="请输入事证号"/>
								</div>
								<div class='form-group'>
									<label>企业期限：</label>
									<input type="text" class="form-control demo-input" name='date' placeholder="请选择营业截止日期" id="test1">
								</div>
								<div class='form-group oc'>
									<label>组织机构代码：</label>
									<input class='form-control organization_code'  name='organization_code' type='text' placeholder="请输入组织机构代码"/>
								</div>
								<div class='form-group taxs'>
									<label>税务登记号：</label>
									<input class='form-control tax' type='text' name="tax" placeholder="请输入税务登记号"/>
								</div>
								<div class='form-group' id="more">
									<label>营业执照图片：</label>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload01.png">
											<input type="file" name="business_img" id="file0" onchange="previewImage(this,0)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload02.png">
											<input type="file" name="code_img" id="file1" onchange="previewImage(this,1)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload03.png">
											<input type="file" name="tax_img" id="file2" onchange="previewImage(this,2)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<p class="tips">注：仅支持JPG,PNG,JEPG格式，所有资质证明问价需加盖公章的复印件或彩色扫描件，三证合一或五证合一的企业只需要提供企业营业执照，不需要提供税务登记证和组织机构代码证，每张小于2MB。</p>
								</div>
								<div class='form-group hide' id="single">
									<label>营业执照图片：</label>

									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload01.png">
											<input type="file" name="single" id="file3" onchange="previewImage(this,3)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<p class="tips">注：仅支持JPG,PNG,JEPG格式，所有资质证明问价需加盖公章的复印件或彩色扫描件，三证合一或五证合一的企业只需要提供企业营业执照，不需要提供税务登记证和组织机构代码证，每张小于2MB。</p>
								</div>
								<div class='form-group'>
									<label>示例：</label>
									<img src="_IMG_/a07.png"/>
									<img src="_IMG_/a02.png"/>
									<img src="_IMG_/a06.png"/>
								</div>
								<a class="nextstep btns" href="javascript:;">下一步</a>
								<br />
								<p class="tips">注：请确认提交的资料是否有误，提交后不可修改！</p>
							</form>
							<!--第二步-->
							<form id="form2" action="" method="post" class='forms secondStep hide'>
								<div class='form-group'>
									<label>法定代表姓名：</label>
									<input class='form-control name' name='legal_name' type='text' placeholder="请输入法定代表人姓名"/>
								</div>
								<div class='form-group'>
									<label>身份证：</label>
									<input type="text" class="form-control idcard" disabled="disabled">
								</div>
								<div class='form-group'>
									<label>证件有效期：</label>
									<input type="text" class="form-control demo-input" disabled="disabled" id="test2">
								</div>
								<div class='form-group'>
									<label>证件图片：</label>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload.png">
											<input type="file" name="legal_face" id="file4" onchange="previewImage(this,4)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload.png">
											<input type="file" name="legal_back" id="file5" onchange="previewImage(this,5)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<p class="tips">注：仅支持JPG,PNG,JEPG格式，身份证照片要求四边可见，画面清晰，每张小于2MB。</p>
								</div>
								<div class='form-group'>
									<label>示例：</label>
									<img src="_IMG_/a03.png"/>
									<img src="_IMG_/a04.png"/>
								</div>
								<a class="prevstep btns" href="javascript:;">上一步</a>
								<a class="nextstep btns" style="margin-left: 15px;" href="javascript:;">下一步</a>
							</form>
							<!--第三步-->
							<form id="form3" action="" method="post" class='forms thirdStep hide'>
								<div class='form-group'>
									<label>负责人姓名：</label>
									<input class='form-control name' name="name" type='text' placeholder="请输入负责人姓名"/>
								</div>
								<div class='form-group'>
									<label>手机号码：</label>
									<input class='form-control phone' name='phone' type='text' placeholder="请输入负责人的手机号码"/>
								</div>
								<div class='form-group'>
									<label>绑定支付宝：</label>
									<input class='form-control alipay' name="alipay" type='text' placeholder="请输入支付宝账号"/>
									<p class="tips">注：请确保该账户在支付宝登记的实名(负责人名称)与收款方真实姓名一致。如未实名，则单日最多只能收款1000元。</p>
								</div>
								<div class='form-group'>
									<label>身份证：</label>
									<input type="text" class="form-control idcard" disabled="disabled">
								</div>
								<div class='form-group'>
									<label>证件有效期：</label>
									<input type="text" class="form-control demo-input" disabled="disabled" id="test3">
								</div>
								<div class='form-group'>
									<label>证件图片：</label>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload.png">
											<input type="file" name="charge_face" id="file6" onchange="previewImage(this,6)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload.png">
											<input type="file" name="charge_back" id="file7" onchange="previewImage(this,7)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<p class="tips">注：仅支持JPG,PNG,JEPG格式，身份证照片要求四边可见，画面清晰，每张小于2MB。</p>
								</div>
								<div class='form-group'>
									<label>示例：</label>
									<img src="_IMG_/a03.png"/>
									<img src="_IMG_/a04.png"/>
								</div>
								<div class='form-group'>
									<label>授权书图片：</label>
									<div class="upload-img file">
										<div class="upload-btn">
											<img src="_IMG_/upload_authorization.jpg">
											<input type="file" name="authorization_image" id="file8" onchange="previewImage(this,8)" accept="image/gif, image/jpeg, image/png">
										</div>
									</div>
									<p class="tips">注：仅支持JPG,PNG,JEPG格式，身份证照片要求四边可见，画面清晰，每张小于2MB。</p>
								</div>
								<div class='form-group'>
									<label>示例：</label>
									<img src="_IMG_/a05.png"/>
								</div>
								<a class="prevstep btns" href="javascript:;">上一步</a>
								<a class="sendAgain btns" href="javascript:;">提交</a>
								<a class="editBtn hide" href="javascript:;">修改</a>
								<p class="tips">注：请确认提交的资料是否有误，提交后不可修改！</p>
							</form>
							<div class="checkStatus hide">
								<!--审核中-->
								<div class="checkDuring hide">
									<img src="_IMG_/checking.png"/>
									<p>实名认证正在审核中，请稍后再查看</p>
								</div>
								<!--审核成功-->
								<div class="checkSuccess hide">
									<p><span class="icons icon-status-success"></span>实名认证已通过，以下内容即为认证信息</p>
									<form id="form4" action="" method="post" class='forms'>
										<div class='form-group'>
											<label>企业名称：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>企业注册号：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>营业期限：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>组织机构代码：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>税务登记号：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>营业执照：</label>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
										</div>
										<div class='form-group'>
											<label>法定代表人姓名：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>身份证：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件有效期：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件图片：</label>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
										</div>
										<div class='form-group'>
											<label>负责人姓名：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>手机号码：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>身份证：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件有效期：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件图片：</label>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
										</div>
										<div class='form-group'>
											<label>授权书：</label>
											<img height="150px" src=""/>
										</div>
									</form>
								</div>
								<!--审核失败-->
								<div class="checkFailed hide">
									<p><span class="icons icon-status-failed"></span><span id='failed'></span></p>
									<form id="form5" action="" method="post" class='forms'>
										<div class='form-group'>
											<label>企业名称：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>企业注册号：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>营业期限：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>组织机构代码：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>税务登记号：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>营业执照：</label>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
										</div>
										<div class='form-group'>
											<label>法定代表人姓名：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>身份证：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件有效期：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件图片：</label>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
										</div>
										<div class='form-group'>
											<label>负责人姓名：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>手机号码：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>身份证：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件有效期：</label>
											<span></span>
										</div>
										<div class='form-group'>
											<label>证件图片：</label>
											<img height="150px" src=""/>
											<img height="150px" src=""/>
										</div>
										<div class='form-group'>
											<label>授权书：</label>
											<img height="150px" src=""/>
										</div>
									</form>
									<a class="editBtn1" href="javascript:;" style="margin-left: 135px;">修改</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
{/block}



{block name="js"}

		<script src="_P_/laydate/laydate.js"></script>
<script src="_P_/layer/layer.js"></script>
		<script>
		/*
     *   功能:实现VBScript的DateAdd功能.
     *   参数:interval,字符串表达式，表示要添加的时间间隔.
     *   参数:number,数值表达式，表示要添加的时间间隔的个数.
     *   参数:date,时间对象.
     *   返回:新的时间对象.
     *   var now = new Date();
     *   var newDate = DateAdd( "d", 5, now);
     *---------------   DateAdd(interval,number,date)   -----------------
     */
    function DateAdd(interval, number, date) {
        switch (interval) {
            case "y ": {
                date.setFullYear(date.getFullYear() + number);
                return date;
                break;
            }
            case "q ": {
                date.setMonth(date.getMonth() + number * 3);
                return date;
                break;
            }
            case "m ": {
                date.setMonth(date.getMonth() + number);
                return date;
                break;
            }
            case "w ": {
                date.setDate(date.getDate() + number * 7);
                return date;
                break;
            }
            case "d ": {
                date.setDate(date.getDate() + number);
                return date;
                break;
            }
            case "h ": {
                date.setHours(date.getHours() + number);
                return date;
                break;
            }
            case "m ": {
                date.setMinutes(date.getMinutes() + number);
                return date;
                break;
            }
            case "s ": {
                date.setSeconds(date.getSeconds() + number);
                return date;
                break;
            }
            default: {
                date.setDate(d.getDate() + number);
                return date;
                break;
            }
        }
    }
			$(document).ready(function(){
				//执行一个laydate实例
				laydate.render({
				  elem: '#test1' //指定元素
				});
				laydate.render({
				  elem: '#test2' //指定元素
				});
				laydate.render({
				  elem: '#test3' //指定元素
				});
				var userinfo=$.cookie('userinfo');
				if(userinfo) {
					var user_login = $.base64.decode(userinfo).split(",");
					var uid = user_login[0];
					get_personal(uid);

				
				/*radio切换事件*/
				$('input[type=radio][name=organization]').change(function() {
			        if (this.value == 'normal') {
			        	$('.papers').removeClass('hide');
			            $('.enterprise').removeClass('hide');
			            $('.enterpriseNo').removeClass('hide');
			            $('.institution').addClass('hide');
			            $('.card').addClass('hide');
			        }else{
			            $('.papers').addClass('hide');
			            $('.enterprise').addClass('hide');
			            $('.enterpriseNo').addClass('hide');
			            $('.institution').removeClass('hide');
						$('.oc').removeClass('hide');
						$('.taxs ').removeClass('hide');
			            $('.card').removeClass('hide');
						$('#more').removeClass('hide');
						$('#single').addClass('hide');
			        }
			    });
				$('input[type=radio][name=paper]').change(function() {
			        if (this.value == '1') {
			        	$('.oc').removeClass('hide');
			            $('.taxs').removeClass('hide');
			            $('#more').removeClass('hide');
			            $('#single').addClass('hide');
			        }else{
			            $('#single').removeClass('hide');
			            $('#more').addClass('hide');
			            $('.oc').addClass('hide');
			            $('.taxs').addClass('hide');
			        }
			    });
				
				/*进行第二步*/
				$('#form1 .nextstep').on('click',function(){
					var organization=$('input[type=radio][name=organization]:checked').val();
					var paper=$('input[type=radio][name=paper]:checked').val();
					var date=$('#test1').val();
					if(organization=='normal'){
						var enterprises=$('.enterprises').val();
						var enterpriseNumber=$('.enterpriseNumber').val();
						if(paper==1){
							var organization_code=$('.organization_code').val();
							var tax=$('.tax').val();
							var img1=$('input[name="business_img"]').val();
							var img2=$('input[name="code_img"]').val();
							var img3=$('input[name="tax_img"]').val();
							if (!tax) {
								layer.msg('请填写完整！', {icon: 5});
								return false;
							}
							if (tax.length == 15 || tax.length == 17 || tax.length == 18 || tax.length == 20) {
							} else {
								layer.msg('税务登记号格式不正确！', {icon: 5});
								return false;
							}
							var regexp1 = /^([0-9])|((?=.*?[0-9])(?=.*?[a-zA-Z])[a-zA-Z0-9])$/;
							/*匹配6-16个字符，只能是数字或数字或字母，不包括下划线的正则表达式*/
							if (regexp1.test(tax)) {
							} else {
								//不匹配
								layer.msg('税务登记号格式不正确！', {icon: 5});
								return false;
							}
							if($(".editBtn").hasClass("hide")){
								if(!img3||!img2||!img1||!organization_code||!date||!enterpriseNumber||!enterprises){
									layer.msg('请填写完整！', {icon: 5});
									return false;
								}else{
									$('#form1').addClass('hide');
									$('#form3').addClass('hide');
									$('#form2').removeClass('hide');
								}
							}else{
								if(!organization_code||!date||!enterpriseNumber||!enterprises){
									layer.msg('请填写完整！', {icon: 5});
									return false;
								}else{
									$('#form1').addClass('hide');
									$('#form3').addClass('hide');
									$('#form2').removeClass('hide');
								}
							}
						}else{
							var single=$('input[name="single"]').val();
							if($(".editBtn").hasClass("hide")){
								if(!single||!date||!enterpriseNumber||!enterprises){
									layer.msg('请填写完整！', {icon: 5});
									return false;
								}else{
									$('#form1').addClass('hide');
									$('#form3').addClass('hide');
									$('#form2').removeClass('hide');
								}
							}else{
								if(!date||!enterpriseNumber||!enterprises){
									layer.msg('请填写完整！', {icon: 5});
									return false;
								}else{
									$('#form1').addClass('hide');
									$('#form3').addClass('hide');
									$('#form2').removeClass('hide');
								}
							}

						}
					}else{
						var institutions=$('.institutions').val();
						var cards=$('.cards').val();
						var oc=$('.organization_code').val();
						var ta=$('.tax').val();
						var pic1=$('input[name="business_img"]').val();
						var pic2=$('input[name="code_img"]').val();
						var pic3=$('input[name="tax_img"]').val();
						if (!ta) {
							layer.msg('请填写完整！', {icon: 5});
							return false;
						}
						if (ta.length == 15 || ta.length == 17 || ta.length == 18 || ta.length == 20) {
						} else {
							layer.msg('税务登记号格式不正确！', {icon: 5});
							return false;
						}

						var regex1 = /^([0-9])|((?=.*?[0-9])(?=.*?[a-zA-Z])[a-zA-Z0-9])$/;

						/*匹配6-16个字符，只能是数字或数字或字母，不包括下划线的正则表达式*/
						if (regex1.test(ta)) {
						} else {
							layer.msg('税务登记号格式不正确！', {icon: 5});
							return false;
						}
						if($(".editBtn").hasClass("hide")){
							if(!oc||!date||!institutions||!cards||!pic1||!pic2||!pic3){
								layer.msg('请填写完整！', {icon: 5});
								return false;
							}else{
								$('#form1').addClass('hide');
								$('#form3').addClass('hide');
								$('#form2').removeClass('hide');
							}
						}else{
							if(!oc||!date||!institutions||!cards){
								layer.msg('请填写完整！', {icon: 5});
								return false;
							}else{
								$('#form1').addClass('hide');
								$('#form3').addClass('hide');
								$('#form2').removeClass('hide');
							}
						}

					}
					$('#form1').addClass('hide');
					$('#form3').addClass('hide');
					$('#form2').removeClass('hide');
				});
				/*回到第一步*/
				$('#form2 .prevstep').on('click',function(){
					$('#form2').addClass('hide');
					$('#form3').addClass('hide');
					$('#form1').removeClass('hide');
				});
				/*进行第三步*/
				$('#form2 .nextstep').on('click',function(){
					var legal_name=$('#form2').find('.name').val();
					var idcard=$('#form2').find('.idcard').val();
					var test2=$('#test2').val();
					var pic1=$('#file4').val();
					var pic2=$('#file5').val();
					
					var date1 = new Date(test2.replace(/-/g, "/"));
					var now = new Date();
					var newDate = DateAdd("y ", 1, now);
					var date2 = new Date(newDate.toLocaleDateString());
					
					var show=/^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)$/;
					if(!show.test(idcard)) {
						layer.msg('身份证格式不正确！', {icon: 5});
						return false;
					}
					if($(".editBtn").hasClass("hide")){
						if(!legal_name||!idcard||!test2||!pic1||!pic2){
							layer.msg('请填写完整！', {icon: 5});
							return false;
						}else{
							$('#form2').addClass('hide');
							$('#form1').addClass('hide');
							$('#form3').removeClass('hide');
							if (date1 < date2) {
								layer.msg('证件有效期必须大于入驻时间1年！', {icon: 5});
								return false;
							}
						}
					}else{
						if(!legal_name||!idcard||!test2){
							layer.msg('请填写完整！', {icon: 5});
							return false;
						}else{
							if (date1 < date2) {
								layer.msg('证件有效期必须大于入驻时间1年！', {icon: 5});
								return false;
							}
							$('#form2').addClass('hide');
							$('#form1').addClass('hide');
							$('#form3').removeClass('hide');
						}
					}

					$('#form2').addClass('hide');
					$('#form1').addClass('hide');
					$('#form3').removeClass('hide');
				});
				/*回到第二步*/
				$('#form3 .prevstep').on('click',function(){
					$('#form1').addClass('hide');
					$('#form3').addClass('hide');
					$('#form2').removeClass('hide');
				});
				/*提交表单*/
				$('.sendAgain').on('click',function(){
					//判断
					var nick=$('#form3').find('.name').val();
					var phone=$('#form3').find('.phone').val();
					var alipay=$('#form3').find('.alipay').val();
					var idcard=$('#form3').find('.idcard').val();
					var validate_time=$('#test3').val();
					 
					var date1 = new Date(validate_time.replace(/-/g, "/"));
					var now = new Date();
					var newDate = DateAdd("y ", 1, now);
					var date2 = new Date(newDate.toLocaleDateString());
				
					var image1=$('input[name="charge_face"]').val();
					var image2=$('input[name="charge_back"]').val();
					var image3=$('input[name="authorization_image"]').eq(0).val();
					var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
					if(!myreg.test(phone)) {
						layer.msg('手机号码格式不正确！', {icon: 5});
						return false;
					}
					var show=/^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)$/;
					if(!show.test(idcard)) {
						layer.msg('身份证格式不正确！', {icon: 5});
						return false;
					}
					if(!nick||!phone||!alipay||!idcard||!validate_time||!image1||!image2||!image3){
						layer.msg('请填写完整！', {icon: 5});
						return false;
					}
					
					if (date1 < date2) {
						layer.msg('证件有效期必须大于入驻时间1年！', {icon: 5});
						return false;
					}
					
					//提交
					var from1data = $("#form1").serializeObject();
					var from2data = $("#form2").serializeObject();
					var from3data = $("#form3").serializeObject();
					var media1JsonString = JSON.stringify(from1data);
					var media2JsonString = JSON.stringify(from2data);
					var media3JsonString = JSON.stringify(from3data);
					//var data=from1data+'&'+from2data+'&'+from3data;
					var formData = new FormData();
					formData.append("media1JsonString", media1JsonString);
					formData.append("uid", uid);
					formData.append("media2JsonString", media2JsonString);
					formData.append("media3JsonString", media3JsonString);
					formData.append("authorization_image", $('input[name="authorization_image"]')[0].files[0]);
					formData.append("charge_face", $('input[name="charge_face"]')[0].files[0]);
					formData.append("charge_back", $('input[name="charge_back"]')[0].files[0]);
					formData.append("legal_face", $('input[name="legal_face"]')[0].files[0]);
					formData.append("legal_back", $('input[name="legal_back"]')[0].files[0]);
					formData.append("single", $('input[name="single"]')[0].files[0]);
					formData.append("business_img", $('input[name="business_img"]')[0].files[0]);
					formData.append("code_img", $('input[name="code_img"]')[0].files[0]);
					formData.append("tax_img", $('input[name="tax_img"]')[0].files[0]);
					formData.append("legal_card", $("#form2").find('.idcard').val());
					formData.append("legal_date", $("#test2").val());

					formData.append("card", idcard);
					formData.append("date", validate_time);
					$.ajax({
						type: "post",
						url: "/index.php/api/form/company_add",
						data:formData,
						beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
						},
						dataType: 'json',
						success: function (msg) {
							layer.closeAll();
							if (msg.code == 200) {
								//layer.close(index); //如果设定了yes回调，需进行手工关闭
								get_personal(uid);
							}else{
								layer.msg(msg.message, {icon: 5});
							}
						},
						contentType: false, //必须false才会自动加上正确的Content-Type
						processData: false //必须false才会避开jQuery对 formdata 的默认处理
					});
				});

				}else{
					layer.msg('还未登录！', {icon: 51});
				}
				/*修改提交表单*/
				$('.editBtn').on('click',function(){
					var id=$('#form3').attr('num');
					//判断
					var nick=$('#form3').find('.name').val();
					var phone=$('#form3').find('.phone').val();
					var alipay=$('#form3').find('.alipay').val();
					var idcard=$('#form3').find('.idcard').val();
					var validate_time=$('#test3').val();
					
					var date1 = new Date(validate_time.replace(/-/g, "/"));
					var now = new Date();
					var newDate = DateAdd("y ", 1, now);
					var date2 = new Date(newDate.toLocaleDateString());
					
					var image1=$('input[name="charge"]').eq(0).val();
					var image2=$('input[name="charge"]').eq(1).val();
					var image3=$('input[name="authorization_image"]').eq(0).val();
					var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
					if(!myreg.test(phone)) {
						layer.msg('手机号码格式不正确！', {icon: 5});
						return false;
					}
					var show=/^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)$/;
					if(!show.test(idcard)) {
						layer.msg('身份证格式不正确！', {icon: 5});
						return false;
					}
					if(!nick||!phone||!alipay||!idcard||!validate_time){
						layer.msg('请填写完整！', {icon: 5});
						return false;
					}
					
					if (date1 < date2) {
						layer.msg('证件有效期必须大于入驻时间1年！', {icon: 5});
						return false;
					}
			
					//提交
					var from1data = $("#form1").serializeObject();
					var from2data = $("#form2").serializeObject();
					var from3data = $("#form3").serializeObject();
					var media1JsonString = JSON.stringify(from1data);
					var media2JsonString = JSON.stringify(from2data);
					var media3JsonString = JSON.stringify(from3data);
					//var data=from1data+'&'+from2data+'&'+from3data;
					var formData = new FormData();
					formData.append("media1JsonString", media1JsonString);
					formData.append("id", id);
					formData.append("media2JsonString", media2JsonString);
					formData.append("media3JsonString", media3JsonString);
					formData.append("authorization_image", $('input[name="authorization_image"]')[0].files[0]);
					formData.append("charge_face", $('input[name="charge_face"]')[0].files[0]);
					formData.append("charge_back", $('input[name="charge_back"]')[0].files[0]);
					formData.append("legal_face", $('input[name="legal_face"]')[0].files[0]);
					formData.append("legal_back", $('input[name="legal_back"]')[0].files[0]);
					formData.append("single", $('input[name="single"]')[0].files[0]);
					formData.append("business_img", $('input[name="business_img"]')[0].files[0]);
					formData.append("code_img", $('input[name="code_img"]')[0].files[0]);
					formData.append("tax_img", $('input[name="tax_img"]')[0].files[0]);
					
					formData.append("legal_card", $("#form2").find('.idcard').val());
					formData.append("legal_date", $("#test2").val());

					formData.append("card", idcard);
					formData.append("date", validate_time);
					$.ajax({
						type: "post",
						url: "/index.php/api/form/company_edit",
						data:formData,
						dataType: 'json',
						beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
						},
						success: function (msg) {
							layer.closeAll();
							if (msg.code == 200) {
								//layer.close(index); //如果设定了yes回调，需进行手工关闭
								get_personal(uid);
							}
							if (msg.code == 1000) {
								layer.msg('修改失败！', {icon: 5});
							}
						},
						contentType: false, //必须false才会自动加上正确的Content-Type
						processData: false //必须false才会避开jQuery对 formdata 的默认处理
					});
				})

			});
			/*显示修改表单*/
			$('.editBtn1').on('click',function(){
				$('.checkStatus').addClass('hide');
				$('.checkFailed').addClass('hide');
				$('#form1').removeClass('hide');
			});
			
			
			/**获取认证信息*/
			function get_personal(uid){
				$.ajax({
					type: "get",
					url: "/index.php/api/form/examine_personal",
					data: {
						'uid': uid,
						'status':1
					},
					dataType: 'jsonp',
					success: function (msg) {
						if (msg.code == 200) {
							if(msg.data.static==1){
								$('#form1').addClass('hide');
								$('#form2').addClass('hide');
								$('#form3').addClass('hide');
								$('.checkStatus').removeClass('hide');
								$('.checkDuring').removeClass('hide');
							}
							if(msg.data.static==2){
								$('#form1').addClass('hide');
								$('#form2').addClass('hide');
								$('#form3').addClass('hide');
								$('.checkStatus').removeClass('hide');
								$('.checkSuccess').removeClass('hide');
								$('.checkFailed').addClass('hide');
								$('#form4').find('div').eq(0).find('span').html(msg.data.company_name);
								$('#form4').find('div').eq(1).find('span').html(msg.data.regist_number);
								$('#form4').find('div').eq(2).find('span').html(msg.data.company_year);
								$('#form4').find('div').eq(3).find('span').html(msg.data.o_code);
								$('#form4').find('div').eq(4).find('span').html(msg.data.tax_number);
								if(msg.data.d_type==2){
									$('#form4').find('div').eq(5).find('img').eq(0).attr('src','/Images/company/'+msg.data.business_pic);
									$('#form4').find('div').eq(5).find('img').eq(1).addClass('hide');
									$('#form4').find('div').eq(5).find('img').eq(2).addClass('hide');
								}else{
									$('#form4').find('div').eq(5).find('img').eq(0).attr('src','/Images/company/'+msg.data.business_pic);
									$('#form4').find('div').eq(5).find('img').eq(1).attr('src','/Images/company/'+msg.data.code_pic);
									$('#form4').find('div').eq(5).find('img').eq(2).attr('src','/Images/company/'+msg.data.tax_pic);
								}
								$('#form4').find('div').eq(6).find('span').html(msg.data.legal_name);
								$('#form4').find('div').eq(7).find('span').html(msg.data.legal_card);
								$('#form4').find('div').eq(8).find('span').html(msg.data.legal_date);
								$('#form4').find('div').eq(9).find('img').eq(0).attr('src','/Images/authentication/'+msg.data.legal_face);
								$('#form4').find('div').eq(9).find('img').eq(1).attr('src','/Images/authentication/'+msg.data.legal_back);
								$('#form4').find('div').eq(10).find('span').html(msg.data.nick);
								$('#form4').find('div').eq(12).find('span').html(msg.data.card);
								$('#form4').find('div').eq(11).find('span').html(msg.data.phone);
								$('#form4').find('div').eq(13).find('span').html(msg.data.validity_time);
								$('#form4').find('div').eq(14).find('img').eq(0).attr('src','/Images/authentication/'+msg.data.charge_face);
								$('#form4').find('div').eq(14).find('img').eq(1).attr('src','/Images/authentication/'+msg.data.charge_back);
								$('#form4').find('div').eq(15).find('img').attr('src','/Images/company/'+msg.data.authorization_image);
							}
							if(msg.data.static==3){
								$('.checkStatus').removeClass('hide');
								$('.checkFailed').removeClass('hide');
								$('#failed').html(msg.data.result);
								$('#form5').find('div').eq(0).find('span').html(msg.data.company_name);
								$('#form5').find('div').eq(1).find('span').html(msg.data.regist_number);
								$('#form5').find('div').eq(2).find('span').html(msg.data.company_year);
								$('#form5').find('div').eq(3).find('span').html(msg.data.o_code);
								$('#form5').find('div').eq(4).find('span').html(msg.data.tax_number);
								if(msg.data.d_type==2){
									$('#form5').find('div').eq(5).find('img').eq(0).attr('src','/Images/company/'+msg.data.business_pic);
									$('#form5').find('div').eq(5).find('img').eq(1).addClass('hide');
									$('#form5').find('div').eq(5).find('img').eq(2).addClass('hide');
								}else{
									$('#form5').find('div').eq(5).find('img').eq(0).attr('src','/Images/company/'+msg.data.business_pic);
									$('#form5').find('div').eq(5).find('img').eq(1).attr('src','/Images/company/'+msg.data.code_pic);
									$('#form5').find('div').eq(5).find('img').eq(2).attr('src','/Images/company/'+msg.data.tax_pic);
								}
								$('#form5').find('div').eq(6).find('span').html(msg.data.legal_name);
								$('#form5').find('div').eq(7).find('span').html(msg.data.legal_card);
								$('#form5').find('div').eq(8).find('span').html(msg.data.legal_date);
								$('#form5').find('div').eq(9).find('img').eq(0).attr('src','/Images/authentication/'+msg.data.legal_face);
								$('#form5').find('div').eq(9).find('img').eq(1).attr('src','/Images/authentication/'+msg.data.legal_back);
								$('#form5').find('div').eq(10).find('span').html(msg.data.nick);
								$('#form5').find('div').eq(12).find('span').html(msg.data.card);
								$('#form5').find('div').eq(11).find('span').html(msg.data.phone);
								$('#form5').find('div').eq(13).find('span').html(msg.data.validity_time);
								$('#form5').find('div').eq(14).find('img').eq(0).attr('src','/Images/authentication/'+msg.data.charge_face);
								$('#form5').find('div').eq(14).find('img').eq(1).attr('src','/Images/authentication/'+msg.data.charge_back);
								$('#form5').find('div').eq(15).find('img').attr('src','/Images/company/'+msg.data.authorization_image);

								$('#form3').attr('num',msg.data.id);
								$('.checkDuring').addClass('hide');
								$('.sendAgain').addClass('hide');
								$('.editBtn').removeClass('hide');
								if(msg.data.c_type==2){
									$('input[type="radio"][name="organization"]').attr('checked','checked');
									$('.papers ').addClass('hide');
									$('.enterprise').addClass('hide');
									$('.enterpriseNo').addClass('hide');
									$('.institution').removeClass('hide');
									$('.card').removeClass('hide');
									$('.institutions').val(msg.data.company_name);
									$('.cards').val(msg.data.regist_number);
								}else{
									$('.enterprises').val(msg.data.company_name);

									$('.enterpriseNumber').val(msg.data.regist_number);
								}
								if(msg.data.d_type==2){
									$('input[type="radio"][name="paper"]').attr('checked','checked');
									$('.oc').addClass('hide');
									$('.taxs').addClass('hide');
									$('#more').addClass('hide');
									$('#single').removeClass('hide');
									$('#file3').parent().find('img').attr('src','/Images/company/'+msg.data.business_pic);
								}
								$('#test1').val(msg.data.company_year);
								$('.organization_code').val(msg.data.o_code);
								$('.tax').val(msg.data.tax_number);
								$('#file0').parent().find('img').attr('src','/Images/company/'+msg.data.business_pic);
								$('#file1').parent().find('img').attr('src','/Images/company/'+msg.data.code_pic);
								$('#file2').parent().find('img').attr('src','/Images/company/'+msg.data.tax_pic);
								$('#form2').find('.name').val(msg.data.legal_name);
								$('#form2').find('.idcard').val(msg.data.legal_card);
								$('#test2').val(msg.data.legal_date);
								$('#file4').parent().find('img').attr('src','/Images/authentication/'+msg.data.legal_face);
								$('#file5').parent().find('img').attr('src','/Images/authentication/'+msg.data.legal_back);
								$('#form3').find('.name').val(msg.data.nick);
								$('#form3').find('.idcard').val(msg.data.card);
								$('.phone').val(msg.data.phone);
//								$('.alipay').val(msg.data.alipay);
								$('#test3').val(msg.data.validity_time);
								$('#form3').find('div').eq(2).find('span').html(msg.data.alipay);
								$('#form3').find('div').eq(3).find('span').html(msg.data.phone);
								$('#form3').find('div').eq(4).find('span').html(msg.data.validity_time);
								$('#file6').parent().find('img').attr('src','/Images/authentication/'+msg.data.charge_face);
								$('#file7').parent().find('img').attr('src','/Images/authentication/'+msg.data.charge_back);
								$('#file8').parent().find('img').attr('src','/Images/company/'+msg.data.authorization_image);
							}
						}
						if (msg.code == 1000) {
							$('#form1').removeClass('hide');
						}
					}
				});
			}

			//序列化表单对象
			$.fn.serializeObject = function(){
				var o = {};
				var a = this.serializeArray();
				$.each(a, function() {
					if (o[this.name]) {
						if (!o[this.name].push) {
							o[this.name] = [o[this.name]];
						}
						o[this.name].push(this.value || '');
					} else {
						o[this.name] = this.value || '';
					}
				});
				return o;
			};
			/*限制图标上传大小*/
			// function validate_img(ele){
			// 	var file = ele.value;     
			//  	if(!/.(gif|jpg|jpeg|png|GIF|JPG|bmp)$/.test(file)){       
			// 		alert("图片类型必须是.gif,jpeg,jpg,png,bmp中的一种");
			// 		return false;         
			// 	}else{
			// 		if(((ele.files[0].size).toFixed(2))>=(2*1024*1024)){       
			// 			alert("请上传小于2M的图片");
			// 			return false;
			//       	}
			//   	}
			// }
			//限制上传文件的类型和大小
			function previewImage(obj,num){
				var filepath=$(obj).val();
				fileObj = document.getElementById('file'+num);
				value = window.URL.createObjectURL(fileObj.files[0]);
				file_size = obj.files[0].size;
				size = file_size / 1024;
				if (size > 1024*5) {
					$('#file'+num).val("");
					layer.alert('上传图片不得大于5MB', {
						closeBtn: 0
					});
				} else {
					$(obj).parents(".upload-img").prepend('<div class="img-info"><img src="'+value+'"/><div class="file-panel"><div class="del_cancel"><a class="btn table-btn" style="display:block;width:10px;height:10px;margin-left:190px;text-align:center;" title="删除" href="javascript:;"></a></div></div></div>');
					$(obj).parent(".upload-btn").hide();
					$(obj).parents(".upload-img").children('p').hide();

					$('.img-info').hover(function(){
						$(this).find(".file-panel").show();
					},function(){
						$(this).find(".file-panel").hide();

					});
					$(".del_cancel a").on("click",function(){
						$('#file'+num).val("");
						$(this).parents('.upload-img').find(".upload-btn").show();
						$(this).parents('.upload-img').find(".upload-img p").show();
						$(this).parents(".img-info").remove();

					});
				}
				
				
				
				if (num == 5) {
					var formData1 = new FormData($('#form2')[0]);
					formData1.append('side', 'back');
					formData1.append('legal', '2');
					$.ajax({
						type: "post",
						url: "/index.php/api/form/examine_img",
						data: formData1,
						dataType: 'json',
						beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
						},
						success: function (msg) {
							layer.closeAll();
							if (msg.code == 200) {
								var str = msg.data.end_date;
								var s1 = str.substring(0, 4);
								var s2 = str.substring(4, 6);
								var s3 = str.substring(6, 8);
								$("#test2").val(s1 + "-" + s2 + "-" + s3);
							} else {
								layer.msg(msg.message, {icon: 5});
							}
						},
						contentType: false, //必须false才会自动加上正确的Content-Type
						processData: false //必须false才会避开jQuery对 formdata 的默认处理
					});
				} else if(num == 4) {
					var formData2 = new FormData($('#form2')[0]);
					formData2.append('side', 'face');
					formData2.append('legal', '2');
					$.ajax({
						type: "post",
						url: "/index.php/api/form/examine_img",
						data: formData2,
						dataType: 'json',
						beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
						},
						success: function (msg) {
							layer.closeAll();
							if (msg.code == 200) {
								$('#form2').find(".idcard").val(msg.data.num);
							} else {
								layer.msg(msg.message, {icon: 5});
							}
						},
						contentType: false, //必须false才会自动加上正确的Content-Type
						processData: false //必须false才会避开jQuery对 formdata 的默认处理
					});
				} else if(num == 6) {
					var formData3 = new FormData($('#form3')[0]);
					formData3.append('side', 'face');
					formData3.append('legal', '3');
					$.ajax({
						type: "post",
						url: "/index.php/api/form/examine_img",
						data: formData3,
						dataType: 'json',
						beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
						},
						success: function (msg) {
							layer.closeAll();
							if (msg.code == 200) {
								$('#form3').find(".idcard").val(msg.data.num);
							} else {
								layer.msg(msg.message, {icon: 5});
							}
						},
						contentType: false, //必须false才会自动加上正确的Content-Type
						processData: false //必须false才会避开jQuery对 formdata 的默认处理
					});
				} else if(num == 7) {
					var formData4 = new FormData($('#form3')[0]);
					formData4.append('side', 'back');
					formData4.append('legal', '3');
					$.ajax({
						type: "post",
						url: "/index.php/api/form/examine_img",
						data: formData4,
						dataType: 'json',
						beforeSend: function () {
							var index = layer.load(1, {
								shade: [0.1, '#333333'] //0.1透明度的白色背景
							});
						},
						success: function (msg) {
							layer.closeAll();
							if (msg.code == 200) {
								var str = msg.data.end_date;
								var s1 = str.substring(0, 4);
								var s2 = str.substring(4, 6);
								var s3 = str.substring(6, 8);
								$("#test3").val(s1 + "-" + s2 + "-" + s3);
							} else {
								layer.msg(msg.message, {icon: 5});
							}
						},
						contentType: false, //必须false才会自动加上正确的Content-Type
						processData: false //必须false才会避开jQuery对 formdata 的默认处理
					});
				}

			}

		</script>
{/block}